/*
 * Created on 06-feb-2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.juanfrivaldes.cio2005.gestion;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.juanfrivaldes.cio2005.domain.Usuario;

/**
 * @author root
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class ObtenerMailsAction extends GestionAction {

	private static Log log = LogFactory.getLog(ObtenerMailsAction.class);

	protected ActionForward protectedExecute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		
		String direcciones="";
		List usuarios=this.getCio2005().getUsuarios();
		for(int i=0;i<usuarios.size();i++){
			direcciones+=((Usuario)usuarios.get(i)).getEmail();
			if(i<usuarios.size()-1)
				direcciones+=";";
		}
		request.setAttribute("direcciones",direcciones);
		
		
		return mapping.findForward("success");
		// return mapping.findForward("inicio");
	}

}
